<html class="no-js " lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta name="description" content="Responsive Bootstrap 4 and web Application ui kit.">

    <title>{$site.name|htmlentities}</title>

    <!-- Favicon-->
    <link rel="shortcut icon" href="__CDN__/assets/img/favicon.ico" />

    <link rel="stylesheet" href="__CDN__/template/yuyue/assets/plugins/bootstrap/css/bootstrap.min.css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link href="__CDN__/template/yuyue/assets/css/main.css" rel="stylesheet">


    <!-- Custom Css 
    <link href="__CDN__/assets/css/fullcalendar/main.css" rel="stylesheet">
    <link href="__CDN__/assets/css/fullcalendar/layui.css" rel="stylesheet">
    -->
    <style>
        #cat .aa {
    font-family: 'Material-Design-Iconic-Font';
    display: inline-block;
    position: absolute;
    right: 51px;
    bottom: 2px;
    color: #e66202;
    cursor: pointer;
    font-size: 11px;
    background: none;
    z-index: 9999;
    line-height: 300%;

        }
    </style>
<body class="">
<div class="authentication" style="display: flex;">
    <div class="container" style="    width: 90%;display: flex;
    align-items: center;">
        <div class="col-md-12 content-center">
            <div class="row">

                <div class="col-lg-12 col-md-12">
                    <div class="card-plain">
                        <div class="header">
                            <h5>登录 / 注册</h5>
                        </div>
                        <form class="form">
                            <div class="input-group">
                                <input type="text" id="mobile" class="form-control" name="mobile" placeholder="请输入手机号">
                                <span class="input-group-addon"><i class="zmdi zmdi-smartphone"></i></span>
                            </div>
                            <div class="input-group" id="cat" style="">
                                <input type="text" name="captcha" id="captcha" placeholder="请输入验证码" class="form-control">
                                
                                <span class="input-group-addon"><i class="zmdi zmdi-lock"></i></span>
                                <span class="aa">发送验证码</span>
                            <div style="clear:both;"></div>
                            </div>
                            
                        </form>
                        <div class="footer">
                            <button type="button" class="layui-btn btn btn-primary btn-round btn-block layui-btn-disabled">
                                立即预约
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- Jquery Core Js -->
<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
<script src="__CDN__/assets/libs/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="__CDN__/assets/libs/fastadmin-layer/dist/layer.js"></script>

<!-- Lib Scripts Plugin Js -->
<script>
    $(function () {
        let regexp = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;

        let interval = null;
        let time = 60;
        $(document).on('click', '#cat .aa', function (e) {
            let that = $(this);
            if (that.hasClass('disabled')) {
                return;
            }
            let mobile = $('#mobile').val();
            if (mobile.search(regexp) === -1) {
                return layer.msg('手机号格式不正确！');
            }

            that.text(time--);
            interval = setInterval(function () {
                if (time <= 1) {
                    time = 60;
                    that.text('发送验证码');
                    that.removeClass('disabled');
                    clearInterval(interval);
                    return;
                }
                that.text(time--);
            }, 1000);
            $.post('/api/index/sendLoginSms',{mobile:mobile},function (res){
                if (res.code !== 1) {
                    return layer.msg(res.msg);
                }
                layer.msg(res.msg);
            });
            that.addClass('disabled');
            $('.layui-btn').removeClass('layui-btn-disabled');
        });

        $('.layui-btn').click(function () {
            let captcha = $('#captcha').val();
            if (!captcha) {
                return layer.msg('请填写验证码');
            }
            $.post('login', {account: $('#mobile').val(), captcha: captcha}, function (res) {
                if (res.code !== 1) {
                    return layer.msg(res.msg);
                }
                // localStorage.setItem('token', res.data.token);
                location.href = 'checkIn';
            });
        });
    });
</script>
</body>
</html>